﻿@using CubicFWNet.Data.Models
@using CubicFWNet.Data.ViewModal
@model Worksheet
@{
    //ViewBag.Title = "加工单打印";
    var printDataView = ViewBag.PrintDataView as PrintDataView;
}
<style>
    tr {
    }
</style>
<section class="content-header">
    <h1>
        加工单打印
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index", "Home")">首页</a></li>
    </ol>
</section>
<section class="content">
    @*style="overflow-x: scroll"*@
    <div class="box box-solid" style="width: 1060px;">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                @if (Model != null && printDataView != null)
                {

                    <form class="form-horizontal" id="frmedit" action="@Url.Action("UpdateWorksheetStatus", "Worksheet")" method="post">
                        <span class="btn btn-primary submitbtn" id="print" onclick="print()" style="margin-left: 25px;display: inline-block">打印正面</span>
                        <a class="btn btn-primary submitbtn" href="@Url.Action("PrintWorksheetBack", new {proName = printDataView.ProductName, number = Model.Number})" style="margin-left: 25px; display: inline-block">打印背面</a>

                        <input type="hidden" id="Number" name="Number" value="@Model.Number" />
                        <input type="hidden" id="Id" name="Id" value="@Model.Id" />
                    </form>

                    <div id="queryDlg" style="width: 1000px; margin-left: 25px;">
                        <div width="1000px" align="center">
                            <font size="6">生&nbsp;产&nbsp;加&nbsp;工&nbsp;单</font><br>
                            <div style="text-align: center">
                                @*2017年02月*@
                            </div>
                        </div>
                        <table class="" cellspacing="0" cellpadding="0" width="1000" align="center" border="1" style="font-size: 18px;">
                            @*<thead>
                                    <tr style="text-align: center">
                                        <th></th>
                                        <th></th>
                                        <th></th>
                                    </tr>
                                </thead>*@
                            <tbody>
                                <tr style="text-align: center; height: 38px;">
                                    @*<td colspan="5">版本：@Model.Edition</td>*@
                                    <td colspan="10" style="text-align: right">订单编号：@Model.Number &nbsp;&nbsp;&nbsp;</td>
                                </tr>
                                <tr style="text-align: right; height: 38px;">
                                    <td colspan="10">日期：@Model.CreateTime.Value.ToString("yyyy-MM-dd") &nbsp;&nbsp;&nbsp;</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>产品名称：</td>
                                    <td colspan="4">@printDataView.ProductName</td>
                                    <td>订货数量：</td>
                                    <td colspan="4">@printDataView.WorkAmount.ToString("f0")</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    @if (printDataView.TechnologyItemListView != null)
                                    {
                                        var rowspan = printDataView.TechnologyItemListView.Count() + 2;
                                        <td rowspan='@rowspan'>材料名称：</td>
                                    }
                                    else
                                    {
                                        <td rowspan="2">材料名称：</td>
                                    }
                                    <td colspan="2" rowspan="2">@printDataView.FirstMaterial</td>
                                    <td>宽mm</td>
                                    <td>长mm</td>
                                    @if (printDataView.TechnologyItemListView != null)
                                    {
                                        var rowspan = printDataView.TechnologyItemListView.Count() + 2;
                                        <td rowspan='@rowspan'>应用材料尺寸：</td>
                                    }
                                    else
                                    {
                                        <td rowspan="2">应用材料尺寸：</td>
                                    }
                                    <td>宽mm</td>
                                    <td colspan="2">*</td>
                                    <td>长m</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>@printDataView.SizeWidth</td>
                                    <td>@printDataView.SizeLenth</td>
                                    <td>@printDataView.GiveW.ToString("f2")</td>
                                    <td colspan="2"></td>
                                    <td>@printDataView.GiveH.ToString("f2")</td>
                                </tr>
                                @if (printDataView.TechnologyItemListView != null)
                                {
                                    foreach (var item in printDataView.TechnologyItemListView)
                                    {
                                        <tr style="text-align: center">
                                            <td colspan="2">@item.ProductItemName</td>
                                            <td colspan="2"></td>
                                            <td></td>
                                            <td colspan="2"></td>
                                            <td></td>
                                        </tr>
                                    }
                                }
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" rowspan="3">注意事项与工艺：@printDataView.TechnologMemo</td>
                                    <td>加工正差：</td>
                                    <td>@printDataView.Tolerance</td>
                                    <td colspan="2">模切</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>加工负差：</td>
                                    <td>@printDataView.ToleranceMinus</td>
                                    <td colspan="2">刀模数（排）</td>
                                    <td>@printDataView.Cv</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>角度：</td>
                                    <td>@printDataView.Angel</td>
                                    <td colspan="2">刀模数(左右)</td>
                                    <td>@printDataView.Ch</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="2">颜色要求：</td>
                                    <td colspan="3">@printDataView.Color</td>
                                    <td>跳距：</td>
                                    <td>@printDataView.Distance</td>
                                    <td colspan="2">尺线</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td rowspan="2">加工工时</td>
                                    <td colspan="2">调机、制版：</td>
                                    <td rowspan="2">@printDataView.WorkLenth</td>
                                    <td rowspan="2">分钟</td>
                                    <td>左右间距</td>
                                    <td>@printDataView.Space</td>
                                    <td colspan="2">成品排数</td>
                                    <td>@printDataView.Cv</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="2">印刷：</td>
                                    <td>左右边距</td>
                                    <td>@printDataView.Margin</td>
                                    <td colspan="2">复膜</td>
                                    <td></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td rowspan="2">包装要求</td>
                                    <td>平张</td>
                                    <td>
                                        @if (printDataView.PackRequire == 1)
                                        {
                                            @printDataView.Pack;
                                        }
                                    </td>
                                    <td colspan="2">枚/张</td>
                                    <td>共</td>
                                    <td>
                                        @if (printDataView.PackRequire == 1)
                                        {
                                            @printDataView.PackAmount;
                                        }
                                    </td>
                                    <td colspan="2">张/包</td>
                                    <td></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>卷筒</td>
                                    <td>
                                        @if (printDataView.PackRequire == 2)
                                        {
                                            @printDataView.PackAmount;
                                        }
                                    </td>
                                    <td colspan="2">张/卷</td>
                                    <td>共</td>
                                    <td>
                                        @if (printDataView.PackRequire == 2 && printDataView.PackAmount != 0)
                                        {
                                            var m1 = printDataView.WorkAmount/printDataView.PackAmount;
                                            @m1.ToString("f2")
                                            @*@Html.Raw("0")*@
                                        }
                                        
                                    </td>
                                    <td colspan="2">卷</td>
                                    <td></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td rowspan="2">生产实际工作时间</td>
                                    <td colspan="2">调机、制版：</td>
                                    <td></td>
                                    <td>分钟</td>
                                    <td>理论检验时间：</td>
                                    <td colspan="3"></td>
                                    <td>小时</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="2">印刷：</td>
                                    <td></td>
                                    <td>分钟</td>
                                    <td>质检实际工作时间：</td>
                                    <td colspan="3"></td>
                                    <td>分钟</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>实际完成数量：</td>
                                    <td></td>
                                    <td>张 日期：</td>
                                    <td colspan="2"></td>
                                    <td>质检实际完成数量：</td>
                                    <td colspan="3"></td>
                                    <td>张</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td>实际用料米数：</td>
                                    <td></td>
                                    <td>米</td>
                                    <td colspan="2"></td>
                                    <td>质检实际完成日期：</td>
                                    <td colspan="4"></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" style="text-align: left">其它调机、维修时间记录：</td>
                                    <td>分条时间：</td>
                                    <td colspan="3"></td>
                                    <td>分钟</td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" style="text-align: left"></td>
                                    <td>单张重量：</td>
                                    <td colspan="4"></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" style="text-align: left">手工共用工时：</td>
                                    <td>整包重量：</td>
                                    <td colspan="4"></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" style="text-align: left"></td>
                                    <td>单张厚度：</td>
                                    <td colspan="4"></td>
                                </tr>
                                <tr style="text-align: center; height: 38px;">
                                    <td colspan="5" style="text-align: left"></td>
                                    <td>整包厚度：</td>
                                    <td colspan="4"></td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="10" style="height: 80px;">&nbsp;</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="2">领料名称：</td>
                                    <td>宽mm</td>
                                    <td>长m</td>
                                    <td>卷数</td>
                                    <td colspan="1">退料名称：</td>
                                    <td colspan="2">宽mm</td>
                                    <td colspan="2">长m</td>
                                </tr>
                                @for (int i = 0; i < 3; i++)
                                {
                                    <tr style="height: 38px;">
                                        <td colspan="2">&nbsp;</td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td colspan="1"></td>
                                        <td colspan="2"></td>
                                        <td colspan="2"></td>
                                    </tr>
                                }
                                <tr style="height: 38px;">
                                    <td colspan="2">发料人：</td>
                                    <td colspan="3">日期：</td>
                                    <td colspan="1">退料人：</td>
                                    <td colspan="4">日期：</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="2">领料人：</td>
                                    <td colspan="3">日期：</td>
                                    <td colspan="1">接收人：</td>
                                    <td colspan="4">日期：</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="2">原材批号：</td>
                                    <td colspan="3">底纸批号：</td>
                                    <td colspan="5">操作员签名：</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="2">审片员签名：</td>
                                    <td colspan="3">班次：</td>
                                    <td colspan="5">加工设备：@printDataView.EquipmentName</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="5">质检员签名：</td>
                                    <td colspan="5">订购人：@printDataView.Dgren</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="5">分条员签名：</td>
                                    <td colspan="5">落单员签字：@printDataView.OperationName</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="5">生产甩单原因：</td>
                                    <td colspan="5">质检甩单原因：</td>
                                </tr>
                                <tr style="height: 38px;">
                                    <td colspan="2">责任人：</td>
                                    <td colspan="3">班长：</td>
                                    <td colspan="1">责任人：</td>
                                    <td colspan="4">质检：</td>
                                </tr>
                                @*<tr style="text-align: center">
                                        <td>产品名称：</td>
                                        <td>0.0</td>
                                        <td>0.0</td>
                                        <td>原材料</td>
                                        <td>0.0</td>
                                        <td>0.0</td>
                                        <td>原材料</td>
                                        <td>0.0</td>
                                        <td>0.0</td>
                                        <td>0.0</td>
                                    </tr>*@
                            </tbody>
                        </table>
                    </div>
                    <div style="margin-top: 90px;">&nbsp;</div>

                    <div id="queryDlgBack" style="width: 1000px; margin-left: 25px;display: none">
                        <table class="" cellspacing="0" cellpadding="0" width="1000" align="center" border="1" style="font-size: 18px;">
                            <tbody>
                                <tr style="text-align: center; height: 37px;">
                                    <td colspan="20">生产部首件确认记录</td>
                                </tr>
                                <tr style="text-align: center; height: 37px;">
                                    <td colspan="1">产品名</td>
                                    <td colspan="6">@printDataView.ProductName</td>
                                    <td colspan="2">加工单号</td>
                                    <td colspan="2">@Model.Number</td>
                                    <td colspan="1">操作员</td>
                                    <td colspan="2"></td>
                                    <td colspan="1">加工日期</td>
                                    <td colspan="1"></td>
                                    <td colspan="1">检验员</td>
                                    <td colspan="3">12</td>
                                </tr>
                                <tr style="text-align: center; ">
                                    <td rowspan="2">序号</td>
                                    <td colspan="8" style="height: 12px;">尺寸-mm</td>
                                    <td rowspan="2">颜色</td>
                                    <td rowspan="2">内容</td>
                                    <td rowspan="2">边距</td>
                                    <td rowspan="2">跳距</td>
                                    <td rowspan="2">出卷方向</td>
                                    <td rowspan="2">撕裂线</td>
                                    <td rowspan="2">底纸</td>
                                    <td rowspan="2">检验时间</td>
                                    <td colspan="2" style="height: 12px;">结果</td>
                                    <td rowspan="2">备注</td>
                                </tr>
                                <tr style="text-align: center; ">
                                    <td>标准1</td>
                                    <td>测量值1</td>
                                    <td>标准2</td>
                                    <td>测量值2</td>
                                    <td>标准3</td>
                                    <td>测量值3</td>
                                    <td>标准4</td>
                                    <td>测量值4</td>
                                    <td>合格</td>
                                    <td>不合格</td>
                                </tr>
                                <tr style="text-align: center; height: 37px;">
                                    <td>1首检</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                                <tr style="text-align: center; height: 5px;">
                                    <td colspan="20"></td>
                                </tr>

                                <tr style="text-align: center; height: 37px;">
                                    <td colspan="20">质检部首件确认记录</td>
                                </tr>
                                <tr style="text-align: center; height: 37px;">
                                    <td colspan="1">产品名</td>
                                    <td colspan="6">@printDataView.ProductName</td>
                                    <td colspan="2">加工单号</td>
                                    <td colspan="2">@Model.Number</td>
                                    <td colspan="1">操作员</td>
                                    <td colspan="2"></td>
                                    <td colspan="1">加工日期</td>
                                    <td colspan="1"></td>
                                    <td colspan="1">检验员</td>
                                    <td colspan="3">12</td>
                                </tr>
                                <tr style="text-align: center; ">
                                    <td rowspan="2">序号</td>
                                    <td colspan="8" style="height: 12px;">尺寸-mm</td>
                                    <td rowspan="2">颜色</td>
                                    <td rowspan="2">内容</td>
                                    <td rowspan="2">边距</td>
                                    <td rowspan="2">跳距</td>
                                    <td rowspan="2">出卷方向</td>
                                    <td rowspan="2">撕裂线</td>
                                    <td rowspan="2">底纸</td>
                                    <td rowspan="2">检验时间</td>
                                    <td colspan="2" style="height: 12px;">结果</td>
                                    <td rowspan="2">备注</td>
                                </tr>
                                <tr style="text-align: center;">
                                    <td>标准1</td>
                                    <td>测量值1</td>
                                    <td>标准2</td>
                                    <td>测量值2</td>
                                    <td>标准3</td>
                                    <td>测量值3</td>
                                    <td>标准4</td>
                                    <td>测量值4</td>
                                    <td>合格</td>
                                    <td>不合格</td>
                                </tr>
                                @for (int i = 0; i < 3; i++)
                                {
                                    var tempName = "1首检";
                                    if (i == 1)
                                    {
                                        tempName = "2巡检";
                                    }
                                    if (i == 2)
                                    {
                                        tempName = "3巡检";
                                    }
                                    <tr style="text-align: center; height: 37px;">
                                        <td>@tempName</td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                }

                                <tr style="text-align: center; height: 5px;">
                                    <td colspan="20"></td>
                                </tr>

                                <tr style="text-align: center; height: 37px;">
                                    <td colspan="20">成品检验记录表</td>
                                </tr>
                                <tr style="text-align: center;">
                                    <td rowspan="2">检验日期</td>
                                    <td rowspan="2">检验员</td>
                                    <td rowspan="2">加工单号</td>
                                    <td rowspan="2" colspan="6">产品名称</td>
                                    <td rowspan="2">生产数(pcs)</td>
                                    <td rowspan="2">检验数(pcs)</td>
                                    <td colspan="6" style="height: 12px;">不良统计</td>
                                    <td colspan="2" style="height: 12px;">结论</td>
                                    <td rowspan="2">不良处理</td>
                                </tr>
                                <tr style="text-align: center;">
                                    <td colspan="2">不良原因1</td>
                                    <td colspan="2">不良数量1</td>
                                    <td>不良原因2</td>
                                    <td>不良数量2</td>
                                    <td>合格</td>
                                    <td>不合格</td>
                                </tr>
                                @for (int i = 0; i < 4; i++)
                                {
                                    var tempName = "";
                                    if (i == 0)
                                    {
                                        tempName = printDataView.ProductName;
                                    }
                                    <tr style="text-align: center; height: 30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td colspan="5">@tempName</td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td colspan="2"></td>
                                        <td colspan="2"></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                }
            </div>
        </div>
    </div>
</section>

@section Scripts {
    <script src="~/Scripts/jquery.jqprint-0.3.js"></script>
    <script>
        $(document).ready(function () {
            @*$("#frmedit").validate({
                submitHandler: function (form) {
                    var postData = $(form).formSerialize();
                    $.submitForm({
                        url: $(form).attr("action"),
                        param: postData,
                        success: function () {
                            //$.reload();
                            $.modalAlert("操作成功", "success");
                            window.location.href = '@Url.Action("Check", "Worksheet")';
                        }
                    });
                }
            });*@
        });

        function formsubmit(t) {
            $("#frmedit").submit();
        }

        function print() {
            $('#queryDlg').jqprint();
        }
        function printBack() {
            $('#queryDlgBack').jqprint();
        }

    </script>
}

